﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Management.master" AutoEventWireup="true"
    CodeFile="mail-sending.aspx.cs" Inherits="car_mail_sending" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <style type="text/css">
        .modalBackground
        {
            background-color: Gray;
            filter: alpha(opacity=40);
            opacity: 0.5;
        }
        .ModalWindow
        {
            border: solid1px#c0c0c0;
            background: #f0f0f0;
            padding: 0px10px10px10px;
            position: absolute;
            top: -1000px;
        }
    </style>
    <div class="contents">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <table width="100%" cellpadding="3" cellspacing="0" border="0">
            <tr>
                <td colspan="2">
                    <table cellpadding="1" cellspacing="1" border="0">
                        <div style="display: none;">
                            <asp:TextBox ID="txtCarId" runat="server"></asp:TextBox>
                            <asp:TextBox ID="txtProviderId" runat="server"></asp:TextBox>
                            <asp:TextBox ID="txtUserId" runat="server"></asp:TextBox>
                            <asp:TextBox ID="txtExcel" runat="server" Text=""></asp:TextBox>
                            <asp:TextBox ID="txtPDF1" runat="server" Text=""></asp:TextBox>
                            <asp:TextBox ID="txtPDF2" runat="server" Text=""></asp:TextBox>
                            <asp:TextBox ID="txtPDF3" runat="server" Text=""></asp:TextBox>
                        </div>
                        <tr>
                            <td colspan="2">
                                <h1>
                                    Car - Mail Sending</h1>
                            </td>
                        </tr>
                        <asp:UpdatePanel ID="upnlSearch" runat="server">
                        <ContentTemplate>
                        <asp:Panel ID="pnlSearch" runat="server">
                            <tr>
                                <td style="width: 200; height: 30px;" valign="top" align="right">
                                    <b>Package Type</b>
                                </td>
                                <td valign="top">
                                    <asp:DropDownList ID="ddlPackageType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPackageType_SelectedIndexChanged">
                                        <asp:ListItem Text="Online Package" Value="ONLINE"></asp:ListItem>
                                        <asp:ListItem Text="Non GG Package" Value="NONGG"></asp:ListItem>
                                    </asp:DropDownList>
                                    &nbsp;&nbsp; <b>QuoteRefNo</b>&nbsp;&nbsp;
                                    <asp:TextBox ID="txtSearch" runat="server" Width="150px" ToolTip="Search by ReferenceNo"
                                        MaxLength="20" />
                                    <asp:Button ID="btnSearch" runat="server" Text="Submit" ValidationGroup="search"
                                        Width="80px" OnClick="btnSearch_Click" />
                                    <asp:RequiredFieldValidator runat="server" ID="rfvSearch" ControlToValidate="txtSearch"
                                        ErrorMessage="<Enter Valid QuoteRefNo" Text="Enter Valid QuoteRefNo" ValidationGroup="search"></asp:RequiredFieldValidator><br />
                                    <asp:Label runat="server" ID="lblSearchMessage" Text="" Font-Bold="true" ForeColor="Red" />
                                </td>
                            </tr>
                        </asp:Panel>
                        </ContentTemplate>
                        </asp:UpdatePanel>
                    </table>
                </td>
            </tr>
            <tr>
                <td style="width: 50%;">
                    <table cellpadding="1" cellspacing="1" border="0">
                        <asp:Panel ID="pnlCarDetails" runat="server">
                            <tr>
                                <td colspan="2" style="height:35px;">
                                    <b style="font-size: 18px; font-weight: bold; color: Blue;">Car Details</b>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 200;">
                                    Reference No.
                                </td>
                                <td align="left">
                                    :&nbsp;<asp:Label ID="lblUpRefNo" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 200;">
                                    Applicant's Name
                                </td>
                                <td align="left">
                                    :&nbsp;<asp:Label ID="lblUpApplicantName" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 200;">
                                    Insurance Company
                                </td>
                                <td align="left">
                                    :&nbsp;<asp:Label ID="lblUpInsurer" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 200;">
                                    Plan Name
                                </td>
                                <td align="left">
                                    :&nbsp;<asp:Label ID="lblUpPlanName" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 200;">
                                    Premium
                                </td>
                                <td align="left">
                                    :&nbsp;<asp:Label ID="lblUpPremium" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 200;">
                                    Payment Type
                                </td>
                                <td align="left">
                                    :&nbsp;<asp:Label ID="lblUpPaymentType" runat="server" Font-Bold="true"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 200;">
                                    Payment Status
                                </td>
                                <td align="left">
                                    :&nbsp;<asp:Label ID="lblUpPaymentStatus" runat="server" Font-Bold="true"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 200;">
                                    Application Status
                                </td>
                                <td align="left">
                                    :&nbsp;<asp:Label ID="lblUpApplicationStatus" runat="server" Font-Bold="true"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 200;">
                                    Excel File
                                </td>
                                <td align="left">
                                    :&nbsp;<asp:Label ID="lblUpExcel" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 200;">
                                    PDF File
                                </td>
                                <td align="left">
                                    :&nbsp;<asp:Label ID="lblUpPDF" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr runat="server" visible="false" id="trGenerateExcel">
                                <td style="width: 200;">&nbsp;</td>
                                <td align="left">
                                    <asp:Button runat="server" ID="btnGenerateExcel" Text="GenerateExcel" OnClick="btnGenerateExcel_Click" />
                                </td>
                            </tr>
                        </asp:Panel>
                    </table>
                </td>
                <td style="width: 50%;" valign="top">
                    <table cellpadding="1" cellspacing="1" border="0">
                        <asp:Panel ID="pnlMail" runat="server" Visible="false">
                            <tr>
                                <td colspan="2" style="height:35px;">
                                    <b style="font-size: 18px; font-weight: bold; color: Blue;">Mail Sending</b>
                                </td>
                            </tr>
                            <asp:UpdatePanel runat="server" ID="upnlTowho">
                                <ContentTemplate>
                                    <tr>
                                        <td style="width: 250;">
                                            Language
                                        </td>
                                        <td align="left">
                                            :&nbsp;<asp:DropDownList ID="ddlLanguage" runat="server" Width="150px">
                                                <asp:ListItem Text="English" Value="EN"></asp:ListItem>
                                                <asp:ListItem Text="Thai" Value="TH"></asp:ListItem>
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 250;">
                                            To Who?
                                        </td>
                                        <td align="left">
                                            :&nbsp;<asp:DropDownList ID="ddlToWho" runat="server" Width="150px" AutoPostBack="true" OnSelectedIndexChanged="ddlToWho_SelectedIndexChanged">
                                                <asp:ListItem Text="Test" Value="TEST"></asp:ListItem>
                                                <asp:ListItem Text="Customer" Value="CUST"></asp:ListItem>
                                                <asp:ListItem Text="Provider" Value="PROV"></asp:ListItem>
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                            <asp:Panel ID="pnlTester" runat="server" Visible="false">
                                <tr>
                                    <td style="width: 250;">
                                        Who Email?
                                    </td>
                                    <td align="left">
                                        :&nbsp;<asp:DropDownList ID="ddlWhoEmail" runat="server" Width="150px">
                                            <asp:ListItem Text="Customer" Value="CUST"></asp:ListItem>
                                            <asp:ListItem Text="Provider" Value="PROV"></asp:ListItem>
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 250;">
                                        Tester Email
                                    </td>
                                    <td align="left">
                                        :&nbsp;<asp:TextBox ID="txtTesterEmail" runat="server" MaxLength="100" Width="250px"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="rfvTesterEmail" runat="server" ControlToValidate="txtTesterEmail"
                                            Display="Dynamic" ErrorMessage="ต้องมีที่อยู่อีเมล (Require Email address)" ValidationGroup="mail"></asp:RequiredFieldValidator>
                                        <asp:RegularExpressionValidator ID="revTesterEmail" runat="server" ControlToValidate="txtTesterEmail"
                                            ErrorMessage="ที่อยู่อีเมลไม่ถูกต้อง (Invalid Email address)." ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                            ValidationGroup="mail" Display="Dynamic"></asp:RegularExpressionValidator>
                                    </td>
                                </tr>
                            </asp:Panel>
                            <tr>
                                <td style="width: 250; height:40px;">&nbsp;</td>
                                <td>
                                    <asp:Button ID="btnSendMail" runat="server" Text="Send Mail" OnClick="btnSendMail_Click"
                                        ValidationGroup="mail" OnClientClick="return SubmitConfirm();" />
                                    <asp:Label ID="lblMessage" runat="server" ForeColor="Green"></asp:Label>
                                    <asp:Label ID="lblError" runat="server" ForeColor="red"></asp:Label>
                                </td>
                            </tr>
                        </asp:Panel>
                    </table>
                </td>
            </tr>
        </table>

        <script type="text/javascript">
            function SubmitConfirm() {
                var _retVal = false;
                if (Page_ClientValidate('mail')) {
                    _retVal = confirm('Confirm to SUBMIT?');
                }
                else {
                    ShowDiv();
                }
                return _retVal;
            }
        </script>

    </div>
</asp:Content>
